<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:if test="${teamQuery.message != null}">
	<script type=text/javascript>
	  <!--
		  alert("${teamQuery.message}");
		  window.location = "team.htm?module=list"
	  //-->
	</script>
</c:if>

<c:if test="${teamMapAttribute.moduleTeamMap=='list'}">
<h2>Add Team</h2>
<hr />
<a href="teamForm.htm?module=add">Add Team</a>
<table border="1" width="350px">
	<tr>
		<th width="10%" bgcolor="#0000CC"><font color="#FFFFFF"><b>No</b></font></th>
		<th width="60%" bgcolor="#0000CC"><font color="#FFFFFF"><b>Team Name</b></font></th>
		<th width="30%" bgcolor="#0000CC"><font color="#FFFFFF"><b>Action</b></font></th>		
	</tr>
	<c:forEach items="${teamMapAttribute.teamListMap}" var="team" varStatus="teamCount">
	<tr>
	    <c:if test="${teamCount.count % 2 == 0}">
	    	<td align="center" bgcolor="#C1E0FF">${teamCount.count}</td>
			<td align="left" bgcolor="#C1E0FF">${team.name}</td>
			<td align="center" bgcolor="#C1E0FF">
			    <a href="teamEdit.htm?teamId=${team.id}">Edit</a> | 
			    <a href="teamDelete.htm?teamId=${team.id}" onClick="return confirm('Are you sure to delete this data?')">Delete</a>
			</td>
	    </c:if>
	    <c:if test="${teamCount.count % 2 == 1}">
	    	<td align="center" bgcolor="#E1F0FF">${teamCount.count}</td>
			<td align="left" bgcolor="#E1F0FF">${team.name}</td>
			<td align="center" bgcolor="#E1F0FF">
			    <a href="teamEdit.htm?teamId=${team.id}">Edit</a> | 
			    <a href="teamDelete.htm?teamId=${team.id}" onClick="return confirm('Are you sure to delete this data?')">Delete</a>
			</td>
	    </c:if>
	</tr>
	</c:forEach>
</table>
</c:if>

<c:if test="${teamFormAttribute.moduleTeamMap=='add'}">
<h2>Football Team List Page</h2>
<hr/>
<input type="hidden" name="actionTeam" value="add">
<form action="team.htm" method="post">    
	<table>	
		<tr>
			<td>Team Name</td>
			<td>:</td>
			<td><input type="text" name="teamName" value=""></td>
		</tr>		
		<tr>
			<td></td>
			<td></td>
			<td>
			  <input type="submit" name="save" value="Save" onClick="return confirm('Are you sure to save this data?')"/>
			  <input type="button" name="cancel" value="Cancel" onClick="window.location='team.htm?module=list'"/>
			</td>			
		</tr>
	</table>
</form>
</c:if>

<c:if test="${teamFormAttribute.moduleTeamMap=='edit'}">
<h2>Update Team</h2>
<hr/>
<form action="teamEdit.htm" method="post">
    <input type="hidden" name="teamId" value="${teamFormAttribute.teamId}">   
    <input type="hidden" name="actionTeam" value="edit">
	<table>	
		<tr>
			<td>Team Name</td>
			<td>:</td>
			<td><input type="text" name="teamName" value="${teamFormAttribute.teamName}"></td>
		</tr>		
		<tr>
			<td></td>
			<td></td>
			<td>
				<input type="submit" name="edit" value="Edit" onClick="return confirm('Are you sure to edit this data?')"/>
				<input type="button" name="cancel" value="Cancel" onClick="window.location='team.htm?module=list'"/>
			</td>			
		</tr>
	</table>
</form>
</c:if>
